<!--  -->
<template>
  <div>
    <el-row :gutter="20"> </el-row>
    <el-divider></el-divider>

    <groupCharts
      id="group_chart"
      :menulist="menulist"
      :groupInfo="groupInfo"
      v-loading="loadingVisible"
      element-loading-text="------正在进行群体分析------"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.8)"
    ></groupCharts>
  </div>
</template>

<script>
var echarts = require("echarts");
require("echarts-wordcloud");
import ECharts from "vue-echarts";
import "echarts/lib/chart/bar";
import "echarts/lib/component/legend";
import "echarts/lib/component/tooltip";
import "echarts-wordcloud";
import groupCharts from "./GroupCharts";

export default {
  data() {
    return {
      groupInfo: "",
      menulist: [],
      loadingVisible: false,
    };
  },
  methods: {
    async getGroupAnalyze(label_ids) {
      // const { data: res } = await this.$http.post("/indi_profile", this.label_id);
      // var group_info = res.data
      this.loadingVisible = true;
      console.log(label_ids);
      this.$axios({
        url: "http://" + this.$config.server_ip + ":5000/group_analyze",
        method: "get",
        params: { label_ids: "" + label_ids },
      }).then((res) => {
        console.log(res.data);
        this.groupInfo = res.data.group_Info;
        console.log(this.groupInfo);
        this.groupMeta = res.data.group_Meta;
        var menulist = [];
        for (var k in this.groupInfo) {
          menulist.push(k);
        }
        this.menulist = menulist;
        this.loadingVisible = false;
        this.$message("群体查询成功");
      });
    },
  },
  components: {
    groupCharts: groupCharts,
  },
  //生命周期 - 创建完成（访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    console.log(this.label_ids);
    if (this.label_ids.length != 0) {
      this.getGroupAnalyze(this.label_ids);
    }
  },
  props: ["label_ids"],
};
</script>
<style scoped>
/* @import url(); 引入css类 */
</style>
